#ifndef PHOTOUTIL_H
#define PHOTOUTIL_H

#include <QtCore/QObject>
#include <QPixmap>

#include "../global/xnamespace.h"

class QQmlEngine;
class QJSEngine;

X_BEGIN_NAMESPACE

// 照片处理工具
class PhotoUtil : public QObject
{
    Q_OBJECT

public:
    PhotoUtil();

    static PhotoUtil& instance();
    static const char* qmlName();
    static QObject *qmlInstance(QQmlEngine *engine, QJSEngine *scriptEngine);

public:
    QString saveToLocalByBareJid(QByteArray data, QString bareJid);
    QString createThumbnail(const QString& originFile, int width, int height);

private:
    static PhotoUtil* createInstance();

private:
    QPixmap m_pixmap;

private:
    static char QML_NAME[];
};

X_END_NAMESPACE

#endif // PHOTOUTIL_H
